import type { Metadata } from "next"; import Link from "next/link"; import { EventRow } from "@/components/market/event-row"; import { InstrumentTable } from "@/components/market/instrument-table"; import { Empty, Kv, Page, PageHeader, Section, Stat } from "@/components/ui/section"; import { StatusBadge } from "@/components/ui/status-badge"; import { api } from "@/lib/api"; import { formatDateTime } from "@/lib/format"; import type { Breadth, Exchange, ExchangeStatus, InstrumentWithQuote, MarketEvent } from "@/lib/types"; interface Detail { exchange: Exchange; status: ExchangeStatus; holidays: Array<{ date: string; name: string; kind: string; closeTime: string | null }>; instruments_tracked: number; instruments_quoted: number; breadth: Breadth; gainers: InstrumentWithQuote[]; losers: InstrumentWithQuote[]; most_active: InstrumentWithQuote[]; events: MarketEvent[]; } export const dynamic = "force-dynamic"; export async function generateMetadata({ params }: { params: Promise<{ id: string }> }): Promise { const { id } = await params; try { const d = await api(`/v1/exchanges/${encodeURIComponent(id)}`); return { title: `${d.exchange.name} — status, hours, movers`, description: `${d.exchange.name} (${d.exchange.mic ?? d.exchange.id}): session state, local time, holidays, breadth and the largest moves among instruments Market Atlas tracks.`, alternates: { canonical: `/exchanges/${d.exchange.id}` } }; } catch { return { title: "Exchange" }; } } export default async function ExchangePage({ params }: { params: Promise<{ id: string }> }) { const { id } = await params; const d = await api(`/v1/exchanges/${encodeURIComponent(id)}`); const e = d.exchange; const sessions = e.sessions; const sessionText = sessions.continuous ? "Continuous (24/7)" : sessions.regular.map((s) => `${s.open}–${s.close}`).join(", "); return ( Exchanges · {e.country} } title={e.name} lead={`${e.operator ? `${e.operator} · ` : ""}${e.city ?? ""} · ${e.timezone}${e.website ? "" : ""}`} actions={
local {d.status.localTime} {e.website && ( website ↗ )}
} />
d.breadth.decliners ? "pos" : d.breadth.decliners > d.breadth.advancers ? "neg" : undefined} />
{d.events.length ? (
    {d.events.map((ev) => ( ))}
) : ( No events recorded for this venue yet. )}
); }